let 成绩 = /^\d{1,3}(\.\d{1,2})?$/; //匹配成绩，1-3位数字(.1-2位数字)

// 滚动条
window.scrollTo({
  top: 0,
  behavior: "smooth",
});

// 消息提示
this.$message({
  showClose: true,
  message: "这是一条消息提示",
  type: "success",
});
["success", "warning", "error"];

// 路由跳转-新页面打开
let routerJump = this.$router.resolve({
  path: "/studentInfo",
  query: { uid: row.uid },
});
window.open(routerJump.href, "_blank");
// 获取路由参数
this.uid = this.$route.query.uid;

// el-card点击事件失效，需要@click.native
// el-inpu键盘事件失效，需要@keyup.enter.native
// 使用scss时用::v-deep。使用stylus时使用\deep\

var compare = function (prop) {
  return function (obj1, obj2) {
    var val1 = obj1[prop];
    var val2 = obj2[prop];
    if (!isNaN(Number(val1)) && !isNaN(Number(val2))) {
      val1 = Number(val1);
      val2 = Number(val2);
    }
    if (val1 < val2) {
      return -1;
    } else if (val1 > val2) {
      return 1;
    } else {
      return 0;
    }
  };
};
result.danmuList = result.danmuList.sort(compare("time"));

this.$confirm("此操作将删除该课程, 是否继续?", "提示", {
  confirmButtonText: "确定",
  cancelButtonText: "取消",
  type: "warning",
  center: true,
})
  .then(async () => {
    await foo();
    this.$message.success(data.msg);
  })
  .catch(() => {
    this.$message({
      type: "info",
      message: "已取消删除",
    });
  });

// 取消默认事件
e.preventDefault(); //w3c
e.returnValue = false; //IE
// 阻止事件冒泡
e.stopPropagation(); //w3c
e.cancelBubble = true; //IE

keyup.enter.native //回车事件
event.target.bulr() //弹窗中表单回车提交后，清空表单会触发输入框空校验，因此在请空前让输入框脱离焦点

// 批量导入文件
// webpack
const modulesWP = require.context('./modules', true, /\.vue$/)
// vite
const modulesVT = import.meta.globEager("./components/*.vue");

// v-model父子组件传参
const props = defineProps({
  modelValue: {
    default: []
  },
})
const emits = defineEmits(['update:modelValue'])
